<?php
include_once(PATH_SQL . 'user_account_sql.php');
include_once(PATH_MODEL . 'user_account_model.php');
include_once(PATH_VIEW_ADMIN . 'user_account_view.php');
include_once(PATH_INCLUDE."constant.php");
include_once(PATH_INCLUDE."thumb.php");

$oModelUserAccount = new Model_UserAccount();
$oViewUserAccount = new View_Admin_UserAccount($oModelUserAccount);
$sAction=$_REQUEST['sAction'];
$oUpload = new Upload($_FILES);
switch($sAction) {
    case "add_new_form": 
    	$oViewUserAccount->addNewUserAccountForm($oModelUserAccount);
    	break;
    case "do_add_new":
    	$oModelUserAccount->insertUserAccount($fileUpload);
    	redir('?sMod=user_account_index');
    	break;
    case"do_delete":
    	$oModelUserAccount->deleteUserAccountById($_REQUEST[id]);
    	redir('?sMod=user_account_index');
    	break;
    case"edit_form":
    	$oViewUserAccount->editUserAccountForm($oModelUserAccount);
    	break;
    case"do_edit":
        $oModelUserAccount->updateUserAccountById($_REQUEST[id]);
    	redir('?sMod=user_account_index');
    case "add_new_form_packet": 
    	$oViewUserAccount->addNewUserAccountForm($oModelUserAccount);
    	break;
    case "do_add_new":
    	$oModelUserAccount->insertUserAccount($fileUpload);
    	redir('?sMod=packet_index');
    case"do_delete":
    	$oModelUserAccount->deleteUserAccountById($_REQUEST[id]);
    	redir('?sMod=packet_index');
    	break;
    case"edit_form":
    	$oViewUserAccount->editUserAccountForm($oModelUserAccount);
    	break;
    case"do_edit":
        $oModelUserAccount->updateUserAccountById($fileUpload, $_REQUEST[id]);
    	redir('?sMod=packet_index');
    default:
		$oViewUserAccount->displayUserAccountIndex($oModelUserAccount);
		break;
}

$oViewUserAccount->displayPage($oModelUserAccount);
